package com.hashbee.ctxinit;

import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.context.ApplicationContext;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;

@Component
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
public class AppCtxUtils {

    private static ApplicationContext applicationContext;

    public AppCtxUtils(ApplicationContext applicationContext) {
        this.applicationContext = applicationContext;
    }

    public static <T> T getBean(Class<T> clazz){
        return applicationContext.getBean(clazz);
    }

}
